package com.jiaquyun.jcyx.main.cart

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jiaquyun.jcyx.R
import com.jiaquyun.jcyx.entity.Goods
import com.module.lemlin.image.loadCenterImage
import java.lang.StringBuilder

class CartSettlementAdapter :
    BaseQuickAdapter<Goods, BaseViewHolder>(R.layout.item_goods_settlement) {
    override fun convert(holder: BaseViewHolder, item: Goods) {
        holder.setText(R.id.tvGoodsSettlementName, item.goods_name)
            .setText(
                R.id.tvGoodsSettlementPrice,
                StringBuilder().append("￥").append(item.member_goods_price)
            )
            .setText(
                R.id.tvGoodsSettlementCount,
                StringBuilder().append("x").append(item.goods_num)
            )
            .getView<ImageView>(R.id.ivGoodsSettlementIcon)
            .loadCenterImage(item.image)
    }
}